package com.concurrency.example.singleton;

/**
 * 懒汉式，通过静态内部类创建
 */
public class SingletonExample8 {
    private SingletonExample8(){
        System.err.println("调用构造方法创建类！");
    }

    private static class SingletonExample8Handle{
        private static final SingletonExample8 singletonExample8 = new SingletonExample8();
    }

    public static SingletonExample8 fetchSingletonExample8(){
        System.err.println("返回被创建的类！");
        return SingletonExample8Handle.singletonExample8;
    }
}
